<?php

namespace app\company\model;

use app\common\model\BaseModel;
use app\common\model\CompanyWarehouse;
use app\common\model\Dealer;
use app\mini\model\Salesman;
use think\model\relation\BelongsTo;
use think\model\relation\HasMany;

class CompanyTransferOrder extends BaseModel
{
    public function detail(): HasMany
    {
        return $this->hasMany(CompanyTransferOrderDetail::class, 't_oid', 'id');
    }

    public function apply(): BelongsTo
    {
        return $this->belongsTo(Salesman::class, 'apply_user_id');
    }

    public function audit(): BelongsTo
    {
        return $this->belongsTo(CompanyUser::class, 'audit_user_id');
    }

    public function startW(): BelongsTo
    {
        return $this->belongsTo(CompanyWarehouse::class, 'start_warehouse_id');
    }

    public function endW(): BelongsTo
    {
        return $this->belongsTo(CompanyWarehouse::class, 'end_warehouse_id');
    }

    public function dealer(): BelongsTo
    {
        return $this->belongsTo(Dealer::class, 'dealer_id');
    }
}